package com.bugsnag.ohos.reactnative;


import com.bugsnag.ohos.Breadcrumb;
import com.bugsnag.ohos.DateUtils;

import java.util.Locale;
import java.util.Map;

public class BreadcrumbSerializer implements MapSerializer<Breadcrumb> {

    @Override
    public void serialize(Map<String, Object> map, Breadcrumb crumb) {
        map.put("timestamp", DateUtils.toIso8601(crumb.getTimestamp()));
        map.put("message",crumb.getMessage());
        map.put("type",crumb.getType().toString().toLowerCase(Locale.US));
        map.put("metadata",crumb.getMetadata());
    }

}
